Component({
    properties: {
        datas: {
            type: null
        },
        btnFlag: {
            type: null
        },
        page_id: {
            type: null
        }
    },
    data: {
        emptyImage: "https://mini-app-img-1251768088.cos.ap-guangzhou.myqcloud.com/image.png",
        clientWidth: "375",
        selectedMenuIndex: -1,
        routeData: ""
    },
    lifetimes: {
        attached: function() {
            var t = getCurrentPages(), e = t[t.length - 1];
            if (this.setData({
                routeData: e.route
            }), this.data.datas && this.data.datas.title_list.value) for (var a = this.data.datas.title_list.value, i = 0; i < a.length; i++) {
                var n = a[i].h5_link;
                if (n.indexOf(this.data.routeData) >= 0) {
                    if ("packageG/newDiy/newDiy" != this.data.routeData) {
                        this.setData({
                            selectedMenuIndex: i
                        });
                        break;
                    }
                    if (e.options && n.indexOf(Number(e.options.page_id)) >= 0) {
                        this.setData({
                            selectedMenuIndex: i
                        });
                        break;
                    }
                }
            }
        },
        moved: function() {},
        detached: function() {}
    },
    attached: function() {},
    ready: function() {
        this.setData({
            clientWidth: wx.getSystemInfoSync().windowWidth
        });
    },
    pageLifetimes: {
        show: function() {},
        hide: function() {},
        resize: function() {}
    },
    methods: {
        tosearch: function() {
            wx.navigateTo({
                url: "/packageB/member/category/search_v2/search_v2"
            });
        },
        selectedMenu: function(t) {
            var e = t.currentTarget.dataset.item, a = t.currentTarget.dataset.index;
            if (2 == e.is_minApp) if (e.gh_id) if (e.minApp_link) try {
                wx.navigateToMiniProgram({
                    appId: e.gh_id,
                    path: e.minApp_link,
                    extraData: {},
                    envVersion: "release",
                    success: function(t) {},
                    fail: function(t) {
                        wx.showToast({
                            title: "小程序跳转失败",
                            icon: "none",
                            duration: 2e3
                        });
                    }
                });
            } catch (t) {
                wx.showToast({
                    title: "小程序跳转失败",
                    icon: "none",
                    duration: 2e3
                });
            } else wx.showToast({
                title: "请设置跳转小程序后的跳转链接",
                icon: "none",
                duration: 2e3
            }); else wx.showToast({
                title: "请设置小程序所需跳转appId",
                icon: "none",
                duration: 2e3
            }); else {
                if (e.h5_link === this.data.routeData) return;
                var i = e.h5_link;
                if (this.setData({
                    selectedMenuIndex: a
                }), i) try {
                    wx.redirectTo({
                        url: i
                    });
                } catch (e) {
                    try {
                        wx.reLaunch({
                            url: i
                        });
                    } catch (t) {
                        wx.showToast({
                            title: "链接设置错误:" + i,
                            icon: "none",
                            duration: 2e3
                        });
                    }
                } else wx.showToast({
                    title: "请设置跳转链接",
                    icon: "none",
                    duration: 2e3
                });
            }
        },
        gotoUrl: function() {
            var t = this.data.datas.notice_link && this.data.datas.notice_link.value || {};
            if (2 == t.is_h5) if (t.gh_id) if (t.minApp_link) try {
                wx.navigateToMiniProgram({
                    appId: t.gh_id,
                    path: t.minApp_link,
                    extraData: {},
                    envVersion: "release",
                    success: function(t) {},
                    fail: function(t) {
                        wx.showToast({
                            title: "小程序跳转失败",
                            icon: "none",
                            duration: 2e3
                        });
                    }
                });
            } catch (t) {
                wx.showToast({
                    title: "小程序跳转失败",
                    icon: "none",
                    duration: 2e3
                });
            } else wx.showToast({
                title: "请设置跳转小程序后的跳转链接",
                icon: "none",
                duration: 2e3
            }); else wx.showToast({
                title: "请设置小程序所需跳转appId",
                icon: "none",
                duration: 2e3
            }); else {
                var e = t.link;
                try {
                    wx.navigateTo({
                        url: e
                    });
                } catch (t) {
                    wx.showToast({
                        title: "链接设置错误",
                        icon: "none",
                        duration: 2e3
                    });
                }
            }
        }
    }
});